$(document).ready(function(){
	$(".form-content").load("/dotcao/upload.html #upload-content", function(){
	    $('#fileupload').fileupload({
    		dataType: 'json',
            done: function (e, data) {
                $.each(data.result, function (index, file) {
                    $('<p/>').text(file.name).appendTo(".personal");
                });
            },
	        progressall: function (e, data) {
	            var progress = parseInt(data.loaded / data.total * 100, 10);
	            $('#progress .bar').css(
	                'width',
	                progress + '%'
	            );
	        }
	    });

	    // Load existing files:
	    $('#fileupload').each(function () {
	        var that = this;
	        $.getJSON(this.action, function (result) {
	            if (result && result.length) {
	                $(that).fileupload('option', 'done')
	                    .call(that, null, {result: result});
	            }
	        });
	    });
	});
});